package com.sskj.mine;

import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.alibaba.android.arouter.launcher.ARouter;
import com.sskj.common.adapter.MyFragmentPagerAdapter;
import com.sskj.common.base.App;
import com.sskj.lib.RConfig;
import com.sskj.lib.base.BaseActivity;
import com.sskj.lib.util.HeySlidingTabLayout;
import com.sskj.lib.util.ViewPagerBoolean;

import java.util.ArrayList;

import butterknife.BindView;

public class DetailsActivity extends BaseActivity<DetailsPresenter> {
    @BindView(R2.id.vpBoolean)
    ViewPagerBoolean viewPager;
    @BindView(R2.id.segmentTabLayout)
    HeySlidingTabLayout slidingTabLayout;

    private String[] titles = {App.INSTANCE.getString(R.string.mine_detailsActivity1_j), App.INSTANCE.getString(R.string.mine_detailsActivity2_j)};

    @Override
    protected int getLayoutId() {
        return R.layout.activity_details;
    }

    @Override
    public DetailsPresenter getPresenter() {
        return new DetailsPresenter();
    }

    @Override
    protected void initView() {
        ArrayList<Fragment> fragments = new ArrayList<>();
        fragments.add((Fragment) ARouter.getInstance().build(RConfig.APP_FRAGMENT_COIN_LIST).navigation());
        fragments.add((Fragment) ARouter.getInstance().build(RConfig.APP_FRAGMENT_COIN_LIST).navigation());
        viewPager.setAdapter(new MyFragmentPagerAdapter(getSupportFragmentManager(), fragments));
        viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
            @Override
            public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

            }

            @Override
            public void onPageSelected(int position) {

            }

            @Override
            public void onPageScrollStateChanged(int state) {

            }
        });
        slidingTabLayout.setViewPager(viewPager, titles);
        slidingTabLayout.setOnTabSelectListener(new HeySlidingTabLayout.OnTabSelectListener() {
            @Override
            public boolean onTabSelect(int position) {
                return true;
            }

            @Override
            public void onTabReselect(int position) {

            }
        });
    }
}
